package com.sp.scmdb.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
import com.sp.scmdb.common.DomainObject;

@Entity
@Table(name = "OBJ_ALARM")
public class Alarm extends DomainObject {

	/** 报警类型 */
	@Column(name = "alarmType")
	private int alarmType;

	/** 卡号 */
	@Column(name = "empID")
	private int empID;

	/** 区域ID */
	@Column(name = "reID")
	private int reID;

	/** 进入时间 */
	@Column(name = "inTime")
	@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
	private DateTime inTime;

	/** 离开时间 */
	@Column(name = "outTime")
	@Type(type = "org.joda.time.contrib.hibernate.PersistentDateTime")
	private DateTime outTime;

	/** 备注 */
	@Column(name = "rmk")
	private String rmk;

	/** 状态 */
	@Column(name = "state")
	private int state;

	/**
	 * 关联人员
	 * 
	 * */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "empID", insertable = false, updatable = false)
	@NotFound(action=NotFoundAction.IGNORE) 
	private Employee employee;
	/**
	 * 关联报警类型
	 * 
	 * */

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "alarmType", insertable = false, updatable = false)
	private AlarmType type;
	/**
	 * 关联区域
	 * 
	 * */

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "reID", insertable = false, updatable = false)
	@NotFound(action=NotFoundAction.IGNORE) 
	private Area area;

	public void setAlarmType(int alarmType) {
		this.alarmType = alarmType;
	}

	public void setEmpID(int empID) {
		this.empID = empID;
	}

	public void setReID(int reID) {
		this.reID = reID;
	}

	/**
	 * @return the alarmType
	 */
	public int getAlarmType() {
		return alarmType;
	}

	/**
	 * @return the empLabel
	 */
	public int getEmpID() {
		return empID;
	}

	/**
	 * @return the reID
	 */
	public int getReID() {
		return reID;
	}

	/**
	 * @return the inTime
	 */
	public DateTime getInTime() {
		return inTime;
	}

	/**
	 * @return the outTime
	 */
	public DateTime getOutTime() {
		return outTime;
	}

	/**
	 * @return the rmk
	 */
	public String getRmk() {
		return rmk;
	}

	/**
	 * @return the state
	 */
	public int getState() {
		return state;
	}

	/**
	 * @param inTime
	 *            the inTime to set
	 */
	public void setInTime(DateTime inTime) {
		this.inTime = inTime;
	}

	/**
	 * @param outTime
	 *            the outTime to set
	 */
	public void setOutTime(DateTime outTime) {
		this.outTime = outTime;
	}

	/**
	 * @param rmk
	 *            the rmk to set
	 */
	public void setRmk(String rmk) {
		this.rmk = rmk;
	}

	/**
	 * @param state
	 *            the state to set
	 */
	public void setState(int state) {
		this.state = state;
	}

	/**
	 * @param reID
	 *            the reID to set
	 */
	public void setReID(Integer reID) {
		this.reID = reID;
	}

	/**
	 * @return the employee
	 */
	public Employee getEmployee() {
		return employee;
	}

	/**
	 * @return the type
	 */
	public AlarmType getType() {
		return type;
	}

	/**
	 * @param employee
	 *            the employee to set
	 */
	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(AlarmType type) {
		this.type = type;
	}

	public Area getArea() {
		return area;
	}

	public void setArea(Area area) {
		this.area = area;
	}

}
